<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<!DOCTYPE html>

<f:view locale="#{languageBean.locale}">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title><h:outputText value="#{msg.index_title}"/></title>
            <link href="<% out.print(request.getContextPath());%>/resources/css/position.css" rel="stylesheet" type="text/css" />
            <% session.removeAttribute("extendedDataTableBean"); %>
        </head>
        <body>
            <jsp:include page="/pages/fragments/header.jsp" />
            <a4j:form id="login-panel">
                <rich:panel header="#{msg.index_title}">
                    <h:panelGrid columns="3">
                        <h:outputLabel value="#{msg.Username}: " />
                        <h:inputText id="username" value="#{login.username}"
                                     required="true"
                                     requiredMessage="#{msg.required_text_error}"
                                     validatorMessage="#{msg.string_validator}"                                     
                                     >
                            <f:validator validatorId="StringValidator" />
                        </h:inputText>
                        <h:message for="username" errorClass="error-message"/>
                        
                        <h:outputLabel value="#{msg.Password}: " />
                        <h:inputSecret  id="password" value="#{login.password}"
                                    required="true"
                                     requiredMessage="#{msg.required_text_error}"
                                     validatorMessage="#{msg.string_validator}">
                            <f:validator validatorId="StringValidator" />
                        </h:inputSecret>
                        <h:message for="password" errorClass="error-message" />
                        
                        <h:outputLabel value="#{msg.login_as}: " />
                        <h:selectOneRadio value="#{login.type}" required="true" id="type"
                                          requiredMessage="#{msg.required_radio_erro}">
                            <f:selectItem itemValue="usl" itemLabel="USL" />
                            <f:selectItem itemValue="medic" itemLabel="#{msg.iteam_medic}" />
                            <f:selectItem itemValue="patient" itemLabel="#{msg.iteam_patient}" />
                        </h:selectOneRadio>
                        <h:message for="type" errorClass="error-message"/>
                        <h:commandButton action="#{login.doLogin}" value="#{msg.login}"/>
                    </h:panelGrid>
                </rich:panel>
            </a4j:form>
            
        </body>
    </html>
</f:view>

